package com.salon.modules.job.controller;

import com.salon.common.http.response.ObjectResult;
import com.salon.common.http.response.PageResult;
import com.salon.modules.job.entity.ScheduleJobLogEntity;
import com.salon.modules.job.service.ScheduleJobLogService;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

/**
 * 定时任务日志
 */
@RestController
@RequestMapping("/sys/scheduleLog")
public class ScheduleJobLogController {

    @Resource
    private ScheduleJobLogService scheduleJobLogService;

    /**
     * 定时任务日志列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("sys:schedule:select")
    public PageResult<ScheduleJobLogEntity> list(@ApiIgnore @RequestParam Map<String, Object> params) {
        return scheduleJobLogService.listByPage(params);
    }

    /**
     * 定时任务日志信息
     */
    @RequestMapping("/info/{logId}")
    @RequiresPermissions("sys:schedule:select")
    public ObjectResult<ScheduleJobLogEntity> info(@PathVariable("logId") Long logId) {
        ScheduleJobLogEntity log = scheduleJobLogService.getById(logId);
        return ObjectResult.success(log);
    }

}
